﻿<Window x:Class="TicketServer.SettingsWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:eT="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended"
		xmlns:p="clr-namespace:TicketServer.Properties"
		xmlns:lex="http://wpflocalizeextension.codeplex.com"
		lex:LocalizeDictionary.DesignCulture="en"
		lex:ResxLocalizationProvider.DefaultAssembly="TicketServer"
		lex:ResxLocalizationProvider.DefaultDictionary="SettingsWindow"
		Title="{lex:LocText WindowTitle}"
		Width="600"
		Height="480"
		Closed="Window_Closed"
		Icon="/TicketServer;component/Icons/Small/Service Manager.png"
		ResizeMode="NoResize"
		ShowInTaskbar="False"
		WindowStartupLocation="CenterOwner"
		WindowStyle="SingleBorderWindow">
	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="200" />
			<ColumnDefinition />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition />
			<RowDefinition Height="34" />
		</Grid.RowDefinitions>

		<ListBox x:Name="listBoxPage"
				 Grid.Row="0"
				 Grid.Column="0"
				 Margin="5"
				 SelectionChanged="listBoxPage_SelectionChanged">
			<ListBoxItem IsSelected="True">
				<StackPanel Margin="0 2" Orientation="Horizontal">
					<Image Width="24" Source="Icons\Medium\vcard.png" />
					<TextBlock Margin="5 0 0 0"
							   VerticalAlignment="Center"
							   Text="{lex:LocText Tickets}" />
				</StackPanel>
			</ListBoxItem>
			<ListBoxItem>
				<StackPanel Margin="0 2" Orientation="Horizontal">
					<Image Width="24" Source="Icons\Medium\db.png" />
					<TextBlock Margin="5 0 0 0"
							   VerticalAlignment="Center"
							   Text="{lex:LocText DataSource}" />
				</StackPanel>
			</ListBoxItem>
		</ListBox>

		<TabControl x:Name="tabControlSettings"
					Grid.Row="0"
					Grid.Column="1"
					Margin="5 3 5 5">
			<TabItem Visibility="Collapsed">
				<StackPanel>
					<GroupBox Margin="5"
							  FontWeight="Bold"
							  Header="{lex:LocText groupSpecialTickets}">
						<Grid Margin="3">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="100" />
								<ColumnDefinition Width="180" />
								<ColumnDefinition Width="*" />
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition />
								<RowDefinition Height="32" />
								<RowDefinition />
							</Grid.RowDefinitions>

							<TextBlock Grid.Row="0"
									   Grid.Column="0"
									   Grid.ColumnSpan="3"
									   FontWeight="Normal"
									   Text="{lex:LocText groupSpecialTicketsHeader}" />

							<TextBlock Grid.Row="1"
									   Grid.Column="0"
									   HorizontalAlignment="Right"
									   VerticalAlignment="Center"
									   FontWeight="Normal"
									   Text="{lex:LocText groupSpecialTicketsString}" />
							<TextBox x:Name="textBoxSpecialCards"
									 Grid.Row="1"
									 Grid.Column="1"
									 Margin="4"
									 Text="{Binding SpecialTicketsString,
													Source={x:Static p:Settings.Default},
													Mode=TwoWay}" />

							<TextBlock Grid.Row="2"
									   Grid.Column="1"
									   Grid.ColumnSpan="2"
									   FontSize="10"
									   FontWeight="Normal"
									   Text="{lex:LocText groupSpecialTicketsFooter}" />
						</Grid>
					</GroupBox>
				</StackPanel>
			</TabItem>
			<TabItem Visibility="Collapsed">
				<ScrollViewer VerticalScrollBarVisibility="Auto">
					<StackPanel>
						<GroupBox Margin="5"
								  FontWeight="Bold"
								  Header="{lex:LocText groupBackup}">
							<StackPanel>
								<GroupBox Margin="5" FontWeight="Bold">
									<GroupBox.Header>
										<CheckBox x:Name="checkBoxBackupFolder"
												  Content="{lex:LocText groupBackupFolder}"
												  IsChecked="{Binding FileBackup,
																	  Source={x:Static p:Settings.Default},
																	  Mode=TwoWay}" />
									</GroupBox.Header>
									<Grid Margin="5" IsEnabled="{Binding IsChecked, ElementName=checkBoxBackupFolder}">
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="*" />
											<ColumnDefinition Width="Auto" />
										</Grid.ColumnDefinitions>
										<Grid.RowDefinitions>
											<RowDefinition />
											<RowDefinition />
										</Grid.RowDefinitions>

										<TextBlock Grid.Row="0"
												   Grid.Column="0"
												   HorizontalAlignment="Right"
												   VerticalAlignment="Center"
												   Text="{lex:LocText groupBackupInterval}" />
										<eT:ButtonSpinner Grid.Row="0"
														  Grid.Column="1"
														  Margin="3"
														  Spin="ButtonSpinner_Spin">
											<TextBox Text="{Binding FileBackupInterval, Source={x:Static p:Settings.Default}, Mode=TwoWay}" />
										</eT:ButtonSpinner>
										<TextBlock Grid.Row="0"
												   Grid.Column="2"
												   Margin="3"
												   HorizontalAlignment="Left"
												   VerticalAlignment="Center"
												   Text="{lex:LocText groupBackupMinutes}" />

										<TextBlock Grid.Row="1"
												   Grid.Column="0"
												   HorizontalAlignment="Right"
												   VerticalAlignment="Center"
												   Text="{lex:LocText groupBackupTargetFolder}" />
										<TextBox Grid.Row="1"
												 Grid.Column="1"
												 Margin="3"
												 Text="{Binding FileBackupFolder,
																Source={x:Static p:Settings.Default},
																Mode=TwoWay}" />
										<Button x:Name="buttonBrowse"
												Grid.Row="1"
												Grid.Column="2"
												Margin="3"
												Click="buttonBrowse_Click"
												Content="..." />
									</Grid>
								</GroupBox>
								<eT:BusyIndicator x:Name="busyIndicatorFTP" BusyContent="{lex:LocText Resources:PleaseWait}">
									<GroupBox Margin="5" FontWeight="Bold">
										<GroupBox.Header>
											<CheckBox x:Name="checkBoxBackupFTP"
													  Content="{lex:LocText groupBackupFTP}"
													  IsChecked="{Binding FTPBackup,
																		  Source={x:Static p:Settings.Default},
																		  Mode=TwoWay}" />
										</GroupBox.Header>

										<Grid Margin="5" IsEnabled="{Binding IsChecked, ElementName=checkBoxBackupFTP}">
											<Grid.ColumnDefinitions>
												<ColumnDefinition Width="Auto" />
												<ColumnDefinition Width="*" />
												<ColumnDefinition Width="Auto" />
											</Grid.ColumnDefinitions>
											<Grid.RowDefinitions>
												<RowDefinition />
												<RowDefinition />
												<RowDefinition />
												<RowDefinition />
												<RowDefinition />
												<RowDefinition />
											</Grid.RowDefinitions>

											<TextBlock Grid.Row="0"
													   Grid.Column="0"
													   HorizontalAlignment="Right"
													   VerticalAlignment="Center"
													   Text="{lex:LocText groupBackupInterval}" />
											<eT:ButtonSpinner Grid.Row="0"
															  Grid.Column="1"
															  Margin="3"
															  Spin="ButtonSpinner_Spin">
												<TextBox Text="{Binding FTPBackupInterval, Source={x:Static p:Settings.Default}, Mode=TwoWay}" />
											</eT:ButtonSpinner>
											<TextBlock Grid.Row="0"
													   Grid.Column="2"
													   Margin="3"
													   HorizontalAlignment="Left"
													   VerticalAlignment="Center"
													   Text="{lex:LocText groupBackupMinutes}" />

											<TextBlock Grid.Row="1"
													   Grid.Column="0"
													   HorizontalAlignment="Right"
													   VerticalAlignment="Center"
													   Text="{lex:LocText groupBackupServer}" />
											<TextBox Grid.Row="1"
													 Grid.Column="1"
													 Margin="3"
													 Text="{Binding FTPBackupServer,
																	Source={x:Static p:Settings.Default},
																	Mode=TwoWay}" />

											<TextBlock Grid.Row="2"
													   Grid.Column="0"
													   HorizontalAlignment="Right"
													   VerticalAlignment="Center"
													   Text="{lex:LocText groupBackupUser}" />
											<TextBox Grid.Row="2"
													 Grid.Column="1"
													 Margin="3"
													 Text="{Binding FTPBackupUser,
																	Source={x:Static p:Settings.Default},
																	Mode=TwoWay}" />

											<TextBlock Grid.Row="3"
													   Grid.Column="0"
													   HorizontalAlignment="Right"
													   VerticalAlignment="Center"
													   Text="{lex:LocText groupBackupPassword}" />
											<PasswordBox x:Name="passwordBoxFTP"
														 Grid.Row="3"
														 Grid.Column="1"
														 Margin="3" />

											<TextBlock Grid.Row="4"
													   Grid.Column="0"
													   HorizontalAlignment="Right"
													   VerticalAlignment="Center"
													   Text="{lex:LocText groupBackupTargetFolder}" />
											<TextBox Grid.Row="4"
													 Grid.Column="1"
													 Margin="3"
													 Text="{Binding FTPBackupFolder,
																	Source={x:Static p:Settings.Default},
																	Mode=TwoWay}" />
											<Button x:Name="buttonBrowseFTP"
													Grid.Row="4"
													Grid.Column="2"
													Margin="3"
													Click="buttonBrowseFTP_Click"
													Content="..."
													Visibility="Collapsed" />

											<Button x:Name="buttonTestFTP"
													Grid.Row="5"
													Grid.Column="1"
													Margin="3"
													Click="buttonTestFTP_Click"
													Content="{lex:LocText groupBackupFTPTest}" />
										</Grid>
									</GroupBox>
								</eT:BusyIndicator>
								<StackPanel Orientation="Horizontal">
									<TextBlock Margin="5" Text="{lex:LocText groupBackupAttention}" />
									<TextBlock Margin="5"
											   FontWeight="Normal"
											   Text="{lex:LocText groupBackupAttentionText}" />
								</StackPanel>
							</StackPanel>
						</GroupBox>
					</StackPanel>
				</ScrollViewer>
			</TabItem>
		</TabControl>

		<StackPanel Grid.Row="1"
					Grid.Column="1"
					HorizontalAlignment="Right"
					Orientation="Horizontal">
			<Button x:Name="buttonSave"
					Width="100"
					Margin="5"
					Click="buttonSave_Click"
					Content="{lex:LocText ButtonSave}" />
			<Button x:Name="buttonCancel"
					Width="100"
					Margin="5"
					Click="buttonCancel_Click"
					Content="{lex:LocText ButtonCancel}" />
		</StackPanel>
	</Grid>
</Window>
